home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib8 / v_10_12 / 1012018b < prev    next >
Encoding:
Text File  |  1995-11-01  |  314 b   |  18 lines

  1. /* strrchr function */
  2. #include <string.h>
  3.  
  4. char *(strrchr)(const char *s, int c)
  5.     {    /* find last occurrence of c in char s[] */
  6.     const char ch = c;
  7.     const char *sc;
  8.  
  9.     for (sc = NULL; ; ++s)
  10.         {    /* check another char */
  11.         if (*s == ch)
  12.             sc = s;
  13.         if (*s == '\0')
  14.             return ((char *)sc);
  15.         }
  16.     }
  17.  
  18.